package edu.pku.hawk.controller.util;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.TextMessage;

public class MQueue {

	protected Session session;
	protected String queueName;

	public MQueue(String queueName, Session session) {
		this.session = session;
		this.queueName = queueName;
	}

	public Session getSession() {
		return session;
	}

	public String getQueueName() {
		return queueName;
	}

	public void close() throws JMSException {
	}
	
	public static Object toOjbect(Message message) throws JMSException {
		return (message==null) ? null : ((ObjectMessage)message).getObject();
	}
	
	public static String toString(Message message) throws JMSException {
		return (message==null) ? null : ((TextMessage)message).getText();
	}
	

}
